<div class="layuimini-container layuimini-page-anim">
    <div class="layuimini-main">


        <script type="text/html" id="toolbarDemo">
            <div class="layui-btn-container">
                <button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add"> 维修添加 </button>
             </div>
        </script>

        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>




    </div>
</div>

<script>
    layui.use(['form', 'table','miniPage','element'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table,
            miniPage = layui.miniPage;

        table.render({
            elem: '#currentTableId',
            url: SURL+'repair/queryRepairAll2',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            cols: [[
                // {type: "checkbox", width: 50},
                // {field: 'id', width: 80, title: 'ID', sort: true},
                {templet:'<div>{{d.houses.numbers}}</div>',width: 120, title: '房屋编号'},
                {templet:'<div>{{d.customer.custname}}</div>',width: 180, title: '报修人'},
                {templet:'<div>{{d.customer.phone}}</div>',width: 150, title: '联系方式'},
                {templet:'<div>{{d.houses.address}}</div>',width: 150, title: '房地址'},
                {field: 'date', width: 180, title: '报修时间'},
                {filed:'status',title: '报修状态',width: 150,
                    templet: function(res){
                        if(res.status=='1'){
                            return '<span class="layui-badge layui-bg-green">已经维修</span>';
                        }else{
                            return '<span class="layui-badge layui-bg-red">暂未处理</span>';
                        }
                    }}

            ]],
            limits: [10, 15, 20, 25, 50, 100],
            limit: 15,
            page: true,
            id:'testReload',
            skin: 'line'
        });


        /**
         * toolbar事件监听
         */
        table.on('toolbar(currentTableFilter)', function (obj) {
            if (obj.event === 'add') {   // 监听添加操作
                var content = miniPage.getHrefContent('page/other/addrepair.html');
                var openWH = miniPage.getOpenWidthHeight();

                var index = layer.open({
                    title: '添加维修请求',
                    type: 1,
                    shade: 0.2,
                    maxmin:true,
                    shadeClose: true,
                    area: [openWH[0] + 'px', openWH[1] + 'px'],
                    offset: [openWH[2] + 'px', openWH[3] + 'px'],
                    content: content,
                });
                $(window).on("resize", function () {
                    layer.full(myrepair);
                });
            }
        });



    });
</script>